package com.guanzhi.creation.singleton;

import java.util.concurrent.atomic.AtomicLong;

/**
 * 设计模式
 * <p> Package: com.guanzhi.creation.singleton </p>
 * <p> File: SeasonSingleton.java </p>
 * <p> Description:  (创建型模式-单例模式-懒汉式-枚举)</p>
 * <p> Date: 2024/4/12 0:03</p>
 *
 * @author 观之
 * @version 1.0 （代码版本）
 * @email <a href="mailto:guanzhi55634@aliyun.com">观之</a>（邮箱）
 * @date 2024/4/12 0:03
 * @since jdk17（jdk版本）
 */
public enum SeasonSingleton {
    INSTANCE;
    private AtomicLong atomicLong = new AtomicLong(0);

    public long getNumber() {
        return atomicLong.incrementAndGet();
    }

    public static void main(String[] args) {
        System.out.println("SeasonSingleton.INSTANCE.getNumber() = " + SeasonSingleton.INSTANCE.getNumber());
    }
}
